if __name__ == '__main__':
    num = int(input().strip())
    for i in range(num):
        ls = list(map(int, input().strip().split()))
        n, array = ls[0], ls[1:]
        print(sum(array))